package com.lagou.edu.service.impl;


import com.lagou.edu.dao.ResumeDao;
import com.lagou.edu.pojo.Resume;
import com.lagou.edu.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ResumeServiceImpl implements ResumeService {

    @Autowired
    private ResumeDao resumeDao;

    @Override
    public Page<Resume> queryResumeList() throws Exception {
        Pageable pageable  = PageRequest.of(0,100000);
        final Page<Resume> all = resumeDao.findAll(pageable);
        return all;
    }

    @Override
    public Resume queryResumeById(Long id) throws Exception {
        return resumeDao.findById(id).get();
    }

    @Override
    public void saveOrUdpate(Resume resume) throws Exception {
        resumeDao.save(resume);
    }

    @Override
    public void deleteById(Long id) {
        resumeDao.deleteById(id);
    }
}
